<?php
$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
$pagenum = isset($_REQUEST['p']) ? intval($_REQUEST['p']) : 0;

if (isset($_GET['id']) && $_GET['id'] > 0) {
        $imagename = Db::getOneField('img', 'article', 'id='.$id);
        $curpath = $_SERVER['DOCUMENT_ROOT'] . str_replace('/admin', '/upload/', baseUrl());

        if(Db::delete('article',"id=$id")){
            unlink($curpath.$imagename);
            Js::gourl(baseUrl() . '/info?p='.$pagenum);
            exit;
        }
}
?>
